home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / misc / gs261exe.zip / winmaps.ps < prev    next >
Text File  |  1993-05-13  |  4KB  |  109 lines

  1. %    Copyright (C) 1993 Aladdin Enterprises.  All rights reserved.
  2. %
  3. % This file is part of Ghostscript.
  4. %
  5. % Ghostscript is distributed in the hope that it will be useful, but
  6. % WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. % to anyone for the consequences of using it or for whether it serves any
  8. % particular purpose or works at all, unless he says so in writing.  Refer
  9. % to the Ghostscript General Public License for full details.
  10. %
  11. % Everyone is granted permission to copy, modify and redistribute
  12. % Ghostscript, but only under the conditions described in the Ghostscript
  13. % General Public License.  A copy of this license is supposed to have been
  14. % given to you along with Ghostscript so you can know your rights and
  15. % responsibilities.  It should be in a file named COPYING.  Among other
  16. % things, the copyright notice and this notice must be preserved on all
  17. % copies.
  18.  
  19. % winmaps.ps - make maps between PostScript encodings and Windows
  20. % character sets.
  21.  
  22. % Define the two Windows encodings.
  23.  
  24. /ANSIEncoding
  25.   ISOLatin1Encoding 256 array copy
  26.   dup 16#90 /.notdef put
  27.   16#93 1 16#9f { 2 copy /.notdef put pop } for
  28. def
  29.  
  30. /OEMEncoding [
  31.   /.notdef /.notdef /.notdef /heart /diamond /club /spade /bullet
  32.     8 { /.notdef } repeat
  33.   /.notdef /.notdef /.notdef /.notdef /paragraph /section /.notdef /.notdef
  34.     /arrowup /arrowdown /arrowright /arrowleft /.notdef /arrowboth /.notdef /.notdef
  35.   StandardEncoding 32 96 getinterval aload pop
  36.   /Ccedilla /udieresis /eacute /acircumflex /adieresis /agrave /aring /ccedilla
  37.     /ecircumflex /edieresis /egrave /idieresis /igrave /Adieresis /Aring
  38.   /Eacute /ae /AE /ocircumflex /odieresis /ograve /ucircumflex /ugrave
  39.     /ydieresis /Odieresis /Udieresis /cent /sterling /yen /.notdef /florin
  40.   /aacute /iacute /oacute /uacute /ntilde /Ntilde /ordfeminine /ordmasculine
  41.     /questiondown /.notdef /logicalnot /onehalf /onequarter /exclamdown /guillemotleft /guillemotright
  42.   48 { /.notdef } repeat
  43.   /alpha /beta /Gamma /Pi /Sigma /sigma /mu /tau
  44.     /Phi /Theta /Omega /delta /infinity /phi /element /intersection
  45.   /equivalence /plusminus /greaterequal /lessequal /integraltp /integralbt /divide /.notdef
  46.     /degree /dotmath /periodcentered /radical /.notdef /twosuperior /.notdef /.notdef
  47. ] def
  48.  
  49. % Utility procedures
  50.  
  51. /invertencoding        % <array> invertencoding <dict>
  52.  { 256 dict exch dup length 1 sub -1 0
  53.     {    % stack: dict array index
  54.       2 copy get /.notdef ne
  55.        { 2 copy get exch 3 index 3 1 roll put }
  56.        { pop }
  57.       ifelse
  58.     } for
  59.    pop
  60.  } def
  61.  
  62. /pmarray 256 array def
  63. /printmap        % <chars> <decode> printmap -
  64.  { mark 3 1 roll exch
  65.     { 2 copy known { 1 index exch get } { pop 0 } ifelse exch
  66.     }
  67.    forall pop
  68.    pmarray 0 counttomark 2 sub getinterval astore
  69.    ([) print dup length =only 0 exch (] = {\n  ) exch
  70.     { exch print =only
  71.       1 add 15 and dup 0 eq { (,\n  ) } { (, ) } ifelse
  72.     }
  73.    forall pop pop (\n};\n) print pop
  74.  } def
  75.  
  76. /decodeStd StandardEncoding invertencoding def
  77. /decodeISO ISOLatin1Encoding
  78.     % Remove the redundant characters
  79.   dup length array copy
  80.   [8#222 8#225 8#230 8#233 8#240] { 2 copy /.notdef put pop } forall
  81. invertencoding def
  82. /decodeSym SymbolEncoding invertencoding def
  83.  
  84. /decodeANSI ANSIEncoding invertencoding def
  85. /decodeOEM OEMEncoding invertencoding def
  86.  
  87. % Construct the map from Symbol to OEM.
  88.  
  89. (\nprivate const byte far_data gs_map_symbol_to_oem) print
  90. SymbolEncoding decodeOEM printmap
  91.  
  92. % Construct the map from ISOLatin1 to OEM.
  93.  
  94. (\nprivate const byte far_data gs_map_iso_to_oem) print
  95. ISOLatin1Encoding decodeOEM printmap
  96.  
  97. % Construct the map from Standard to ISOLatin1.
  98.  
  99. (\nprivate const byte far_data gs_map_std_to_iso) print
  100. StandardEncoding decodeISO printmap
  101.  
  102. % Construct the map from ISOLatin1 to Standard.
  103. % The Windows driver doesn't need this, but the X11 driver does.
  104.  
  105. (\nprivate const byte far_data gs_map_iso_to_std) print
  106. ISOLatin1Encoding decodeStd printmap
  107.  
  108. quit
  109.